package com.zrrd.propertiesAndIo;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Properties;

/**
 * @author WanJl
 * @version 1.0
 * @title PropertiesDemo03
 * @description
 * @create 2024/5/26
 */
public class PropertiesDemo03 {
    public static void main(String[] args) throws IOException {

        //创建集合对象
        Properties prop = new Properties();

        FileReader fr = new FileReader("./users.properties");
        //加载users.properties文件中的内容
        prop.load(fr);
        //根据key获取value
        String name = prop.getProperty("name");
        String username = prop.getProperty("username");
        String password = prop.getProperty("password");
        System.out.println(name);
        System.out.println(username);
        System.out.println(password);

        fr.close();
    }
}
